<?php 

function option($items, $parent_id, $cat_id, $level=0) {
    foreach ($items as $item) {
        if ($item['id']==$cat_id) continue;
        
        $selected = ($item['id']==$parent_id) ? 'selected' : '';
        echo '<option value="'.$item['id'].'" '.$selected.'>';
        echo str_repeat('├─', $level).$item['name'];
        if (isset($item['children']) && is_array($item['children'])) {
            option($item['children'], $parent_id, $cat_id, $level+1);
        }
        echo '</option>';
    }
}
?>
<style>
.max-line1 {
    text-overflow: -o-ellipsis-lastline;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;	
}
.max-line2 {
    text-overflow: -o-ellipsis-lastline;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}
</style>
<style>
.media-body .summary {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
	text-overflow: ellipsis;
    overflow: hidden;
}
.media-list img {width: 200px;}
@media (max-width: 425px)  {
    .media-list img {width: 115px;}	
    .media-body .summary {display: none;}
}
</style>

<h3 class="page-header">项目列表 
<a href="<?= URL::site('projectDemo/add');?>" class="ajax-click">+</a>
   <span style="font-size: 15px;margin-left: 40px"><a href="<?= URL::site('projectDemo/recovery');?>" >项目回收站</a></span>
</h3>



<div class="table-responsive">
    <table class="table table-hover table-bordered">
        <thead>
        <tr>
            <th>项目名称</th>

            <th>项目类型</th>

            <th>项目行业</th>
            <th>制作时长</th>
            <th>拍摄城市</th>
            <th>预算</th>
            <th>操作</th>

        </tr>
        </thead>
        <tbody id="cat-list">
        <?php foreach ($model as $item):?>
            <tr>
                <td><a href="<?= URL::site('projectDemo/edit?id='.$item['id']);?>"><?= $item['project_name'] ?></a></td>
                <td>
                    <?= $item['project_cid_name'] ?>
                </td>
                <td>
                    <?= $item['profession_cid_name'] ?>
                </td>
                <td>
                    <?= ceil(($item['project_end']-$item['project_begin'])/86400)?>天（<?= date('Y-m-d',$item['project_begin']) ?> 至 <?= date('Y-m-d',$item['project_end']) ?> ）
                </td>
                <td>
                    <?= $item['city'] ?>
                </td>
                <td>
                    <?= $item['actual_budget'] ?>
                </td>
                <td>
                	<?php if ($item['is_recommend']==1):?>
                    	<a href="<?= URL::site('projectDemo/close2?id='.$item['id']);?>" class="btn btn-danger btn-xs ajax-update">不推荐</a>
                    <?php else:?>
                    	<a href="<?= URL::site('projectDemo/open2?id='.$item['id']);?>" class="btn btn-info btn-xs ajax-update">推荐</a>
                    <?php endif;?>
                    
                    <a href="<?= URL::site('projectDemo/false_del?id='.$item['id']);?>" onclick="return confirm('确定将这条记录放入回收站吗？')" class="btn btn-info btn-xs ajax-del">放入回收站</a>
                </td>

            </tr>
        <?php endforeach;?>
        </tbody>

    </table>

</div>
<?= $pager; ?>


